Skip to content

chore: Remove lazy loading for hook registration#22443

Draft
timfish wants to merge 9 commits into
developfrom
timfish/chore/cleanup-hook-register
Draft

chore: Remove lazy loading for hook registration#22443
timfish wants to merge 9 commits into
developfrom
timfish/chore/cleanup-hook-register

Conversation

@timfish

@timfish timfish commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

This PR simplifies the hooks register.ts to remove all the lazy loading.

This involves:

  • Fix a build-time Rollup ESM interop issue
  • Fix NextJs
    • Forces @sentry/server-utils to external so that register.ts can always resolve the hook because it's running in node_modules - Also remove passing tracingHooksPath from previous workaround
    • Makes webpack (via Next's own array-of-functions externals mechanism) treat hook-sync.mjs exactly as it would a CJS package, so Next's handleExternals ESM guard never gets a chance to inspect and throw on it
  • Bumps the @sentry/node size limit by ~80kb. The obfuscation stopped this being bundled and reported in the total size before

The remaining failures are down to:

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 27.78 kB - -
@sentry/browser - with treeshaking flags 26.22 kB - -
@sentry/browser (incl. Tracing) 46.3 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.09 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.13 kB - -
@sentry/browser (incl. Tracing, Replay) 85.58 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.23 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 90.29 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 102.94 kB - -
@sentry/browser (incl. Feedback) 44.97 kB - -
@sentry/browser (incl. sendFeedback) 32.58 kB - -
@sentry/browser (incl. FeedbackAsync) 37.64 kB - -
@sentry/browser (incl. Metrics) 28.86 kB - -
@sentry/browser (incl. Logs) 29.09 kB - -
@sentry/browser (incl. Metrics & Logs) 29.79 kB - -
@sentry/react 29.57 kB - -
@sentry/react (incl. Tracing) 48.61 kB - -
@sentry/vue 33.21 kB - -
@sentry/vue (incl. Tracing) 48.26 kB - -
@sentry/svelte 27.8 kB - -
CDN Bundle 30.12 kB - -
CDN Bundle (incl. Tracing) 48.16 kB - -
CDN Bundle (incl. Logs, Metrics) 31.7 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.49 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.96 kB - -
CDN Bundle (incl. Tracing, Replay) 85.73 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.03 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.51 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.79 kB - -
CDN Bundle - uncompressed 89.75 kB - -
CDN Bundle (incl. Tracing) - uncompressed 144.85 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.47 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 148.83 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.23 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 264.09 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 268.06 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 277.79 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 281.75 kB - -
@sentry/nextjs (client) 51.11 kB - -
@sentry/sveltekit (client) 46.73 kB - -
@sentry/core/server 80.19 kB +0.07% +50 B 🔺
@sentry/core/browser 51.99 kB - -
@sentry/node 124.3 kB +0.03% +27 B 🔺
@sentry/node (incl. diagnostics channel injection) 219.91 kB +46.91% +70.21 kB 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 70.03 kB - -
@sentry/node - without tracing 74.44 kB +0.01% +2 B 🔺
@sentry/aws-serverless 83.94 kB +0.03% +21 B 🔺
@sentry/cloudflare (withSentry) - minified 196.64 kB - -
@sentry/cloudflare (withSentry) 483.92 kB - -

View base workflow run

@timfish timfish changed the title chore: Cleanup hook registration chore: Remove lazy loading for hook registration Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant